<?php
/*
 * @Author: 杨红兵 
 * @Date: 2022-08-16 11:18:47 
 * @Last Modified by: 杨红兵
 * @Last Modified time: 2022-08-16 11:31:30
 */

namespace app\libraries\utils;

class UrlUtil
{
    /**
     * 拼接URL
     *
     * @Author YangHB
     * @DateTime 2022-08-16 11:20:47
     *
     * @param string $host
     * @param string $path
     * @param [type] ...$params
     * @return string
     */
    public static function formatUrl(string $host, string $path, ...$params): string
    {
        $url = rtrim($host, '/') . '/' . ltrim($path, '/');
        $url = sprintf($url, ...$params);
        return $url;
    }
}
